home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / wdj0797.zip / TUFFS.ZIP / EXCEPT2.CPP < prev    next >
C/C++ Source or Header  |  1997-04-24  |  536b  |  24 lines

  1. #include <iostream.h>
  2. #include <except.h>
  3. #include <cstring.h>
  4. #include "warning.h"
  5.  
  6. void badFunction(){
  7.   char* p = 0;
  8.   cout << "The character at " << p << " is " << *p << endl;
  9. }
  10.  
  11. int main(){
  12.   IssueWarning();
  13.   try  {
  14.     cout << "Calling badFunction()" << endl;
  15.     badFunction();
  16.     cout << "badFunction() completed, no exception" << endl;
  17.   } catch (xmsg &x) {
  18.     cerr << "Exception caught '" << x.why() << "'" << endl;
  19.   } catch (...) {
  20.     cerr << "Unknown exception caught" << endl;
  21.   }
  22.   return 0;
  23. }
  24.